# -*- coding: utf-8 -*-
#公共字典数据，主要是为下拉框提供数据
import json

#企业证书字典下拉框获取数据
def getComboboxCompanyCertDict(request):
    request.mysql_52.execute(request.formatSql('''
        select 
            id as code,
            concat(lx,'-',dl,'-',xl,'-',zy) as name 
        from standard.dict_company_apt
    '''))
    rows = request.mysql_52.fetchall()
    return json.dumps(rows, ensure_ascii=False)

def getComboboxDataSourceDict(request):
    request.mysql_52.execute(request.formatSql('''
        select
            data_source_code as code,
            data_source_name as name
        from standard.dict_data_source
        
        -- union all  select 'all' as code,'全部' as name
    '''))
    rows = request.mysql_52.fetchall()
    return json.dumps(rows, ensure_ascii=False)

def getComboboxPersonCertDict(request):
    request.mysql_52.execute(request.formatSql('''
        select 
             CAST(cert_dict_id AS char)  as code,
            concat(qualifi_type,'-',qualifi_name,'-',qualifi_major) as name 
        from standard.dict_person_apt
    '''))
    rows = request.mysql_52.fetchall()
    return json.dumps(rows, ensure_ascii=False)
